<template>
  <div class="app-container">
    <Article :id="id" @article="editArticle" />
  </div>
</template>

<script>
import Article from '@/components/article'
import { editBlog } from '@/api/blog'
export default {
  name: 'Index',
  components: {
    Article
  },
  data() {
    return {
      id: ''
    }
  },
  created() {
    // 获取单页文章的id
    this.id = this.$route.query.id
  },
  methods: {
    editArticle(data) {
      editBlog(data).then(() => {
        this.$router.push('/article/list')
        this.$message.success('编辑成功')
      })
    }
  }
}
</script>

<style scoped>

</style>
